# -*- coding: utf-8 -*-
import os
import isBabel
import sys
if sys.platform=="linux":
	prog="cp -f "
else:
	prog="copy /Y "
def checkTime():
	if os.path.exists(os.path.join("build","index_build.html")):
		time_bak=os.path.getctime(os.path.join("build","index_build.html"))
		time_build=os.path.getctime(os.path.join("build","index.html"))
		if time_bak<time_build:
			src=os.path.join("build","index.html")
			des=os.path.join("build","index_build.html")
			cmd="%s  %s %s" % (prog,src,des)
			print(cmd)
			os.system(cmd)
	else:
		cmd="%s  build/index.html build/index_build.html" % prog
		print(cmd)
		os.system(cmd)
if isBabel.isBabel():
	checkTime()#back
	des=os.path.join("build","index.html")
	cmd ="%s  index_es_bak.html %s" % (prog,des)#copy new
	print(cmd)
	os.system(cmd)
else:
	des=os.path.join("build","index.html")
	cmd ="%s  index_es_bak.html %s" % (prog,des)#copy new
	print(cmd)
	os.system(cmd)	